package com.pet.serve.service;

import com.pet.serve.repository.*;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class IndexServiceImpl implements IndexService {

    private final CustomerRepository customerRepository;

    // 构造器注入
    public IndexServiceImpl(CustomerRepository customerRepository) {
        this.customerRepository = customerRepository;
    }

    /**
     * 获取各项数据的总数
     * @return 各项数据的总数
     */
    public Map<String, Object> getNums() {
        Map<String, Object> result = new HashMap<>();


        // 获取客户总数
        long totoaluser = customerRepository.count();

        result.put("totaluser", totoaluser);

        return result;
    }
}
